﻿IF EXISTS ( 
Select * FROM Information_Schema.COLUMNS
where TABLE_SCHEMA = 'dbo'
AND TABLE_NAME = 'medianamik_NodePropertyValue'
AND Column_Name = 'ModifiedOn'
)
BEGIN
ALTER TABLE dbo.medianamik_NodePropertyValue drop
	ModifiedOn
END

IF NOT EXISTS ( 
Select * FROM Information_Schema.COLUMNS
where TABLE_SCHEMA = 'dbo'
AND TABLE_NAME = 'Localizations'
AND Column_Name = 'ModifiedOn'
)
BEGIN
ALTER TABLE dbo.Localizations ADD
	ModifiedOn datetime default(getdate()) not NULL

END

IF (NOT EXISTS(SELECT 1 FROM Localizations WHERE ResourceId = 'FormTemplateCaption' AND LocaleId = 'fr-ca' AND ResourceSet = 'medianamik_contentmanagement'))
	INSERT INTO Localizations(ResourceId, Value, LocaleId, ResourceSet) VALUES('FormTemplateCaption', 'Légende', 'fr-ca', 'medianamik_contentmanagement')
ELSE
	UPDATE Localizations SET Value = 'Légende' WHERE ResourceId = 'FormTemplateCaption' AND LocaleId = 'fr-ca' AND ResourceSet = 'medianamik_contentmanagement'
	
IF (NOT EXISTS(SELECT 1 FROM Localizations WHERE ResourceId = 'LanguageNeutralCaption' AND LocaleId = 'fr-ca' AND ResourceSet = 'medianamik_contentmanagement'))
	INSERT INTO Localizations(ResourceId, Value, LocaleId, ResourceSet) VALUES('LanguageNeutralCaption', 'Propriété multi-langues', 'fr-ca', 'medianamik_contentmanagement')
ELSE
	UPDATE Localizations SET Value = 'Propriété multi-langues' WHERE ResourceId = 'LanguageNeutralCaption' AND LocaleId = 'fr-ca' AND ResourceSet = 'medianamik_contentmanagement'

IF (NOT EXISTS(SELECT 1 FROM Localizations WHERE ResourceId = 'RequiredFieldCaption' AND LocaleId = 'fr-ca' AND ResourceSet = 'medianamik_contentmanagement'))
	INSERT INTO Localizations(ResourceId, Value, LocaleId, ResourceSet) VALUES('RequiredFieldCaption', 'Propriété obligatoire', 'fr-ca', 'medianamik_contentmanagement')
ELSE
	UPDATE Localizations SET Value = 'Propriété obligatoire' WHERE ResourceId = 'RequiredFieldCaption' AND LocaleId = 'fr-ca' AND ResourceSet = 'medianamik_contentmanagement'


IF (NOT EXISTS(SELECT 1 FROM Localizations WHERE ResourceId = 'LeaveEditionMessage' AND LocaleId = 'fr-ca' AND ResourceSet = 'medianamik_contentmanagement'))
	INSERT INTO Localizations(ResourceId, Value, LocaleId, ResourceSet) VALUES('LeaveEditionMessage', 'Êtes-vous sûr de vouloir quitter l''édition de ce contenu? Vos changements seront perdus.', 'fr-ca', 'medianamik_contentmanagement')
ELSE
	UPDATE Localizations SET Value = 'Êtes-vous sûr de vouloir quitter l''édition de ce contenu? Vos changements seront perdus.' WHERE ResourceId = 'LeaveEditionMessage' AND LocaleId = 'fr-ca' AND ResourceSet = 'medianamik_contentmanagement'

IF (NOT EXISTS(SELECT 1 FROM Localizations WHERE ResourceId = 'SelectImportResource' AND LocaleId = 'fr-ca' AND ResourceSet = 'medianamik_resourcemanagement'))
	INSERT INTO Localizations(ResourceId, Value, LocaleId, ResourceSet) VALUES('SelectImportResource', 'Veuillez choisir un fichier ressource', 'fr-ca', 'medianamik_resourcemanagement')
ELSE
	UPDATE Localizations SET Value = 'Veuillez choisir un fichier ressource' WHERE ResourceId = 'SelectImportResource' AND LocaleId = 'fr-ca' AND ResourceSet = 'medianamik_resourcemanagement'

IF (NOT EXISTS(SELECT 1 FROM Localizations WHERE ResourceId = 'InvalidResourceFile' AND LocaleId = 'fr-ca' AND ResourceSet = 'medianamik_resourcemanagement'))
	INSERT INTO Localizations(ResourceId, Value, LocaleId, ResourceSet) VALUES('InvalidResourceFile', 'Le fichier ressource ne peut pas être importé.', 'fr-ca', 'medianamik_resourcemanagement')
ELSE
	UPDATE Localizations SET Value = 'Le fichier ressource ne peut pas être importé.' WHERE ResourceId = 'InvalidResourceFile' AND LocaleId = 'fr-ca' AND ResourceSet = 'medianamik_resourcemanagement'

IF (NOT EXISTS(SELECT 1 FROM Localizations WHERE ResourceId = 'ExportExcelRessources' AND LocaleId = 'fr-ca' AND ResourceSet = 'medianamik_resourcemanagement'))
	INSERT INTO Localizations(ResourceId, Value, LocaleId, ResourceSet) VALUES('ExportExcelRessources', 'Exporter les ressources en Excel', 'fr-ca', 'medianamik_resourcemanagement')
ELSE
	UPDATE Localizations SET Value = 'Exporter les ressources en Excel' WHERE ResourceId = 'ExportExcelRessources' AND LocaleId = 'fr-ca' AND ResourceSet = 'medianamik_resourcemanagement'
